package com.bw.paper.mvp.model;

import com.bw.paper.mvp.contact.SplashContract;
import com.bw.paper.mvp.base.model.BaseEntity;
import com.bw.paper.mvp.base.model.BaseModel;
import com.bw.paper.entity.ToKenEntity;
import com.bw.paper.Api;
import com.bw.paper.network.ChangeFunction;
import com.bw.paper.network.HttpFactory;
import com.bw.paper.network.HttpType;

import java.util.Map;

import javax.inject.Inject;

import io.reactivex.Observable;

public class SplashModel extends BaseModel implements SplashContract.ISplashModel {

    @Inject
    public SplashModel() {
    }

    @Override
    public Observable<BaseEntity> reqstToken(Map<String, Object> map) {

        Observable<ToKenEntity> observable = HttpFactory.getInstance().factory(HttpType.SIGNTYPE)
                .getRetrofit().create(Api.class)
                .requestToken(createBody(map));

        return observable.map(new ChangeFunction<ToKenEntity>());
    }
}
